# 49. 字母异位词分组

def groupAnagrams(strs):
    dicts = {}
    for s in strs:
        keys = "".join(sorted(s))
        if keys in dicts:
            dicts[keys].append(s)
        else:
            dicts[keys] = [s]
    return list(dicts.values())

if __name__ == "__main__":
    strs = ["eat","tea","tan","ate","nat","bat"]
    print(groupAnagrams(strs))